package com.jzo2o.foundations.controller.consumer;

import com.jzo2o.foundations.model.dto.response.ServeAggregationSimpleResDTO;
import com.jzo2o.foundations.model.dto.response.ServeAggregationTypeSimpleResDTO;
import com.jzo2o.foundations.model.dto.response.ServeCategoryResDTO;
import com.jzo2o.foundations.model.dto.response.ServeSimpleResDTO;
import com.jzo2o.foundations.service.IServeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 用户端 - 区域服务相关接口
 * @author lgongbao
 * @date 2025/9/10
 */
@RestController("consumerServeController")
@RequestMapping("/customer/serve")
@RequiredArgsConstructor
@Api(tags = "用户端 - 区域服务相关接口")
public class ServeController {
    private final IServeService serveService;

    @GetMapping("/firstPageServeList")
    @ApiOperation("首页服务分类及项目")
    public List<ServeCategoryResDTO> firstPageServeList(Long regionId) {
        return serveService.firstPageServeList(regionId);
    }

    @GetMapping("/hotServeList")
    @ApiOperation("精选推荐")
    public List<ServeAggregationSimpleResDTO> hotServeList(Long regionId) {
        return serveService.hotServeList(regionId);
    }
    @GetMapping("/{id}")
    @ApiOperation("查询服务详情")
    public ServeAggregationSimpleResDTO findById(@PathVariable("id") Long id) {
        return serveService.findById(id);
    }

    @GetMapping("/serveTypeList")
    @ApiOperation("查询当前区域下上架服务对应的分类")
    public List<ServeAggregationTypeSimpleResDTO> serveTypeList(Long regionId) {
        return serveService.serveTypeList(regionId);
    }
    @GetMapping("/search")
    @ApiOperation("服务搜索")
    public List<ServeSimpleResDTO> search(String cityCode, String keyword, Long serveTypeId) {
        return serveService.search(cityCode, keyword, serveTypeId);
    }
}
